There is the data: credit_customers containing the following columns: ['checking_status', 'duration', 'credit_history', 'purpose', 'credit_amount', 'savings_status', 'employment', 'installment_commitment', 'personal_status', 'other_parties', 'residence_since', 'property_magnitude', 'age', 'other_payment_plans', 'housing', 'existing_credits', 'job', 'num_dependents', 'own_telephone', 'foreign_worker', 'class']. 
--- The description for each column this data is: 
Checking_status: Status of the applicant's checking account ("no checking": No checking account, "<0": Overdrawn or negative balance, "0<=X<200": Low positive balance, e.g., between $0 and $200, and ">=200": Healthy balance)
Duration: Duration of the loan or credit term (measured in months)
Credit_history: Applicant's past handling of credit ("no credits/all paid": No prior credit or all previous credits paid off, "existing paid": Current credits are being paid off diligently, "critical/other existing credit": Past or current credits with issues, like late payments, "delayed previously": History of delayed payments)
Purpose: Reason for the loan or credit application (purchasing a car, financing education, buying electronics ...etc)
Credit_amount: Amount of money requested in the loan or credit application
Savings_status: Amount of savings the applicant has ("no known savings": No savings account or negligible savings, "<100": Savings less than $100, "100<=X<500": Savings between $100 and $500, "500<=X<1000": Savings between $500 and $1000, and ">=1000": Savings of $1000 or more)
Employment: Applicant's employment status or the length of their current employment ("unemployed": No current employment, "<1": Employed for less than a year, "1<=X<4": Employed between 1 and 4 years, ">=7": Employed for 7 years or more)
Installment_commitment: Portion of the applicant's disposable income that is allocated for loan repayments (represented as a percentage or a fixed numerical value)
Personal_status: Details of the applicant's personal and demographic information ("male single": A single male, "female div/dep/mar": A divorced, separated, or married female, "male div/sep": A divorced or separated male, and "male mar/wid": A married or widowed male)
Other_parties: Any third parties involved in the credit agreement ("none": No other parties involved, "guarantor": A guarantor is present who guarantees repayment, and "co-applicant": Another individual is co-signing the loan)
Residence_since: Length of time the applicant has been living at their current residence (measured in years)
Property_magnitude: Type or value of property the applicant owns, serving as potential collateral ("real estate": Owning a house or land, "life insurance": Having a life insurance policy with a cash value, "car": Owning a car, and "no known property": No property that can be used as collateral)
Age: Age of the applicant
Other_payment_plans: Any other ongoing loans or financial obligations the applicant has outside of the loan in question ("none": No other payment plans or ongoing loans, "bank": The applicant has other loans or payment plans with a bank, and "stores": The applicant has credit obligations with stores or retail chains)
Housing: Living situation of the applicant ("own": The applicant owns their home, "rent": The applicant is renting their living space, and "for free": The applicant lives in a space without paying rent (e.g., with family))
Existing_credits: Number of current credit lines or loans that the applicant already has (represented numerically)
Job: Applicant's employment type ("skilled": Professionally skilled job or a white-collar occupation, "unskilled resident": Unskilled job and residing in the country, "high qualif/self emp/mgmt": Highly qualified, self-employed, or in management positions, and "unemp/unskilled non res": Unemployed, lacks professional or skilled training, and is not a resident of the country)
Num_dependents: Number of individuals financially dependent on the applicant
Own_telephone: Whether the applicant has a telephone
Foreign_worker: Whether the applicant is a foreign worker
Class: Target variable for a predictive model, indicating the risk category of the credit application ("good": Low risk, indicating a high likelihood of timely repayment, or "bad": High risk, suggesting potential difficulties in repaying the loan)
---
Considering contents from the dataset and requirements from user. Please note DO NOT CHANGE FILE AND VARIABLE NAMES THAT I HAVE SET!
Interactions begin:

[USER (data scientist)]:Hi Tapilot, I need your help to analyze the credit_customers dataset. What is the distribution of age, employment status, and credit history among our customers in the credit_customers dataset? Please provide mean, median, mode, range and distribution plots for age, employment status, and credit history.

[YOU (AI assistant)]:Sure, let's start by calculating the descriptive statistics for age, employment status, and credit history. Then, we'll create distribution plots for each of these variables.
'''
import pandas as pd  
import numpy as np  
import matplotlib.pyplot as plt  
import seaborn as sns 
import pickle 
from decision_company import read_csv_file, create_histogram, create_countplot, set_current_ticks, create_figure, set_plot_xlabel, create_figure, set_plot_title, set_yaxis_label, show_plots, save_plot, avg, locate_mode, get_max, get_min_value, calculate_median, count_unique_values

# Load the dataset  
credit_customers = read_csv_file("credit_customers.csv")  
  
# Descriptive statistics for age  
age_column = credit_customers['age']  
age_mean = avg(age_column)  
age_median = calculate_median(credit_customers, 'age')  
age_mode = locate_mode(age_column)[0]  
age_range = get_max(age_column) - get_min_value(age_column)  
  
print(f"Age - Mean: {age_mean}, Median: {age_median}, Mode: {age_mode}, Range: {age_range}")

# Descriptive statistics for employment status  
employment_column = credit_customers['employment'] 
employment_counts = count_unique_values(employment_column)  
  
print("\nEmployment Status Distribution:")  
print(employment_counts)

# Descriptive statistics for credit history  
credit_history_column = credit_customers['credit_history']  
credit_history_counts = count_unique_values(credit_history_column)  
  
print("\nCredit History Distribution:")  
print(credit_history_counts)

# Distribution plot for age  
create_figure((10, 6))  
create_histogram(data=credit_customers, x='age', kde=True, bins=20)  
set_plot_title("Age Distribution")  
set_plot_xlabel("Age")  
set_yaxis_label("Frequency")  
save_plot('./ref_result/histplot.png')  
show_plots()  
  
# Distribution plot for employment status  
create_figure((10, 6))  
create_countplot(data=credit_customers, x='employment', order=employment_counts.index)  
set_plot_title("Employment Status Distribution")  
set_plot_xlabel("Employment Status")  
set_yaxis_label("Frequency")  
save_plot('./ref_result/countplot.png')  
show_plots()  
  
# Distribution plot for credit history  
create_figure((10, 6))  
create_countplot(data=credit_customers, x='credit_history', order=credit_history_counts.index)  
set_plot_title("Credit History Distribution")  
set_plot_xlabel("Credit History")  
set_yaxis_label("Frequency")  
set_current_ticks(rotation=45)  
save_plot('./ref_result/countplot_2.png')  
show_plots()  
'''

[USER (data scientist)]: What is the percentage difference between the number of customers in the most common employment category and the second most common employment category?

My template of code snippet is:

---BEGIN CODE TEMPLATE---

import pandas as pd  
import pickle
from decision_company import read_csv_file, 

# please import the necessary private functions from decision_company first

# Load the dataset  
credit_customers = read_csv_file("credit_customers.csv")   
  
# YOUR SOLUTION BEGIN:
<code1>
[COMPLETE YOUR CODE]   
</code1>
# YOUR SOLUTION END

print(f"The percentage difference between customers with 1 to 4 years of employment and those with 7 or more years of employment is {percentage_difference:.2f}%.")  

# save data
pickle.dump(percentage_difference,open("./pred_result/percentage_difference.pkl","wb"))

---END CODE TEMPLATE---

Please note that you have to generate the WHOLE python code instead of code segments based on the code snippet using Pandas library 2.0.3 version and Matplotlib library 3.7.4 version. You must keep all comments in code snippet unchanged.

[YOU (AI assistant)]:Sure,  here is the code:
'''
import pandas as pd  
import pickle
from decision_company import read_csv_file, 

# please import the necessary private functions from decision_company first

# Load the dataset  
credit_customers = read_csv_file("credit_customers.csv")   
  
# YOUR SOLUTION BEGIN:
